package com.kuang.springcloud.service;


import com.kuang.springcloud.pojo.Dept;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;


//value 配置微服务的名字
@Component
//第二个参数写熔断降级的类名
@FeignClient(value = "SPRING-CLOUD-PROVIDER-DEPT",fallbackFactory = DeptClientFallBackFactory.class)  //写了这个注解就可以被服务直接调用  相当于dubbo中的Refinece
public interface DeptClientService {



//    这里的url一定要和provider的写一致
    @RequestMapping(value = "/dept/get/{id}", method = RequestMethod.GET)
    public Dept queryById(@PathVariable("id") Integer id);


    @RequestMapping(value = "/queryAll", method = RequestMethod.GET)
    public List<Dept> queryAll();

    @RequestMapping(value = "/dept/add", method = RequestMethod.POST)
    public boolean addDept(@RequestBody Dept dept) ;

    @RequestMapping(value = "/dept/discovery",method = RequestMethod.GET)
    public Object discovery();
}
